/* GUI CONVERTED from sosoco.p (converter v1.76) Thu Mar 21 14:06:04 2002 */
/* sosoco.p - CONFIRM SALESORDER SELECTED CRITERIA RANGE OF ORDERS            */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.11 $                                                          */

/*V8:ConvertMode=Report                                                       */

/*  REVISION: 5.0       LAST EDIT: 10/31/88      MODIFIED BY: emb *B003*      */
/*  REVISION: 5.0       LAST EDIT: 11/11/88      MODIFIED BY: emb *B003*      */
/*  REVISION: 5.0       LAST EDIT: 04/03/89      MODIFIED BY: emb *B084*      */
/*  REVISION: 5.0       LAST MODIFIED: 06/23/89  MODIFIED BY: MLB *B159*      */
/*  REVISION: 5.0       LAST MODIFIED: 12/08/89  MODIFIED BY: ftb *B433*      */
/*  REVISION: 5.0       LAST MODIFIED: 02/20/90  MODIFIED BY: emb *B578*      */
/*  REVISION: 5.0       LAST MODIFIED: 04/12/90  MODIFIED BY: emb *B662*      */
/*  REVISION: 5.0       LAST MODIFIED: 08/13/90  MODIFIED BY: emb *B763*      */
/*  REVISION: 6.0       LAST MODIFIED: 05/22/90  MODIFIED BY: WUG *D022*      */
/*  REVISION: 6.0       LAST MODIFIED: 07/06/90  MODIFIED BY: EMB *D040*      */
/*  REVISION: 6.0       LAST MODIFIED: 07/26/91  MODIFIED BY: afs *D792* (rev)*/
/*  REVISION: 7.0       LAST MODIFIED: 06/05/92  MODIFIED BY: tjs *F504* (rev)*/
/*  REVISION: 7.4       LAST MODIFIED: 05/02/94  MODIFIED BY: afs *FL96*      */
/*  REVISION: 7.4       LAST MODIFIED: 03/07/95           by: srk *G0GN*      */
/*  REVISION: 8.6       LAST MODIFIED: 10/22/96   BY: *K004* Kurt De Wit      */
/*  REVISION: 8.6       LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan       */
/*  REVISION: 9.1       LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/*  REVISION: 9.1       LAST MODIFIED: 08/07/00   BY: *L128* Manish K.        */
/* Old ECO marker removed, but no ECO header exists *F0PN*               */
/* Old ECO marker removed, but no ECO header exists *G247*               */
/* Revision: 1.10       BY: Russ Witt             DATE: 09/21/01 ECO: *P01H*  */
/* $Revision: 1.11 $      BY: Julie Milligan         DATE:03/13/02 ECO: *M12Q*  */

/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}
{pxmaint.i}

/* Define the Handles for the ROP programs */
{pxphdef.i giapoxr}
{pxphdef.i sosoxr1}

define new shared variable sonbr like so_nbr.
define new shared variable sonbr1 like so_nbr.
define new shared variable socust like so_cust.
define new shared variable socust1 like so_cust.
define new shared variable socmclass like cm_class.
define new shared variable socmclass1 like cm_class.
define new shared variable soship like so_ship.
define new shared variable soship1 like so_ship.
define new shared variable soorddate like so_ord_date.
define new shared variable soorddate1 like so_ord_date.
define new shared variable soduedate like so_due_date.
define new shared variable soduedate1 like so_due_date.
define new shared variable site  like sod_site.
define new shared variable site1 like sod_site.
define new shared variable edi-conf   like mfc_logical initial no.
define new shared variable soallocate like mfc_logical initial yes
   label "Allocate".
define new shared variable soatpwarn like mfc_logical initial no.
define new shared variable soatperr  like mfc_logical initial no.
define new shared variable sopromdate like mfc_logical initial no.
define new shared variable soUseStdAtpWhenNoApo like mfc_logical initial no.

define variable apoAtpOn               like mfc_logical no-undo.
define variable moduleGroup            as character no-undo initial "SO".
define variable messageDescription     as character no-undo.
define variable messageField           as character no-undo.
define variable messageNumber          like msg_nbr no-undo.

/* APO ATP Global Defines */
{giapoatp.i}


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 

   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
sonbr            colon 20
   sonbr1           colon 45 label {t001.i}
   socust           colon 20
   socust1          colon 45 label {t001.i}
   socmclass        colon 20 label "Customer Class"
   socmclass1       colon 45 label {t001.i}
   soship           colon 20
   soship1          colon 45 label {t001.i}
   soorddate        colon 20
   soorddate1       colon 45 label {t001.i}
   soduedate        colon 20
   soduedate1       colon 45 label {t001.i}
   site             colon 20
   site1            colon 45 label {t001.i} skip(1)
   soallocate       colon 50
   soatpwarn        colon 50
      label "Change Due Dates for ATP Enforcement Warnings"
   soatperr         colon 50
      label "Change Due Dates for ATP Enforcement Errors"
   sopromdate       colon 50 label "Change Promise Date"
   soUseStdAtpWhenNoApo colon 50
      label "Use Standard ATP when APO ATP is Unavailable"
   skip
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

for first soc_ctrl
fields(soc_calc_promise_date)
no-lock: end.

sopromdate = soc_calc_promise_date.

{pxrun.i &proc = 'setUseApoAtpFlag' &program = 'sosoxr1.p'
      &handle=ph_sosoxr1
      &param = "(input moduleGroup,
                 input-output apoAtpOn)"}
if apoAtpOn then do:
   {pxrun.i &proc = 'validateDemandListenerExists' &program = 'giapoxr.p'
       &handle = ph_giapoxr
       &param = "(input 'SO',
                  output messageNumber,
                  output messageField)"
       &catcherror = true
       &noapperror = true
       &module = 'GI1'}

   if return-value <> {&SUCCESS-RESULT} then do:
      {pxmsg.i &MSGNUM = messageNumber
               &ERRORLEVEL= {&WARNING-RESULT}
               &MSGARG1 = messageField}
      if not batchrun then pause.
      {pxmsg.i &MSGNUM     = messageNumber
               &ERRORLEVEL = {&WARNING-RESULT}
               &MSGARG1 = messageField
               &MSGBUFFER  =  messageDescription}
   end.

   {pxrun.i &proc = 'getConfirmationMethodForErrorHandling'
      &program = 'sosoxr1.p'
      &handle=ph_sosoxr1
      &param = "(output soatpwarn,
                 output soatperr,
                 output soUseStdAtpWhenNoApo)"
   }

end. /* apoAtpOn */

repeat:

   if sonbr1 = hi_char then sonbr1 = "".
   if socust1 = hi_char then socust1 = "".
   if socmclass1 = hi_char then socmclass1 = "".
   if soorddate1 = hi_date then soorddate1 = ?.
   if soorddate = low_date then soorddate = ?.
   if soduedate1 = hi_date then soduedate1 = ?.
   if soduedate = low_date then soduedate = ?.
   if soship1 = hi_char then soship1 = "".
   if site1 = hi_char then site1 = "".

   display sopromdate with frame a.
   if not apoAtpOn then do:
      soUseStdAtpWhenNoApo = yes.
      display soUseStdAtpWhenNoApo with frame a.
   end.

   update sonbr
      sonbr1
      socust
      socust1
      socmclass
      socmclass1
      soship
      soship1
      soorddate
      soorddate1
      soduedate
      soduedate1
      site
      site1
      soallocate
      soatpwarn
      soatperr
      sopromdate
      soUseStdAtpWhenNoApo when (apoAtpOn)
   with frame a.

   bcdparm = "".
   {mfquoter.i sonbr  }
   {mfquoter.i sonbr1 }
   {mfquoter.i socust }
   {mfquoter.i socust1}
   {mfquoter.i socmclass}
   {mfquoter.i socmclass1}
   {mfquoter.i soship }
   {mfquoter.i soship1}
   {mfquoter.i soorddate}
   {mfquoter.i soorddate1}
   {mfquoter.i soduedate}
   {mfquoter.i soduedate1}
   {mfquoter.i site}
   {mfquoter.i site1}
   {mfquoter.i soallocate}
   {mfquoter.i soatpwarn}
   {mfquoter.i soatperr}
   {mfquoter.i sopromdate}
   if apoAtpOn then do:
      {mfquoter.i soUseStdAtpWhenNoApo}
   end.

   if sonbr1 = "" then sonbr1 = hi_char.
   if socust1 = "" then socust1 = hi_char.
   if socmclass1 = "" then socmclass1 = hi_char.
   if soship1 = "" then soship1 = hi_char.
   if soorddate1 = ? then soorddate1 = hi_date.
   if soorddate = ? then soorddate = low_date.
   if soduedate1 = ? then soduedate1 = hi_date.
   if soduedate = ? then soduedate = low_date.
   if site1 = "" then site1 = hi_char.

   /* CANNOT RECALC PROMISE DATE IF OFF IN S/O CTRL FILE    */
   if sopromdate = yes and soc_ctrl.soc_calc_promise_date = no then do:
      /* NOT ALLOWED WHEN "CALC PROMISE DATE" = NO IN S/O CONTROL FILE */
      {pxmsg.i &MSGNUM=4559 &ERRORLEVEL=3}
      next-prompt sopromdate with frame a.
      undo, retry.
   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "printer"
               &printWidth = 132
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "yes"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   /* CREATE PAGE TITLE BLOCK */
   {mfphead.i}

   /* If only one site is selected, make sure it's available */
   if site = site1 then do:
      find si_mstr where si_site = site no-lock no-error.
      if available si_mstr and global_db <> ""
         and not connected(si_db) then do:
         {pxmsg.i &MSGNUM=2510 &ERRORLEVEL=3 &MSGARG1=si_db}
         /* Database not available */
         undo, retry.
      end.
   end.

   {gprun.i ""hksosocoa.p""}

   {mfrtrail.i}
end.
